<%@ page contentType="text/html;charset=UTF-8" %> 
<%@ include file="/include.inc.jsp"%>


<div class="pageContent">
<form method="post" id="sysRemindConfigForm" action="${ctx}/sysRemindConfig/save" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);">
    <input type="hidden" name="id" value="${sysRemindConfig.id}"/>
    <div class="panelBar">
        <ul class="toolBar">
            <shiro:hasPermission name="sysRemindConfig:edit">
            <li><a class="save" href="#" onclick="hrefSave_OnClick('sysRemindConfigForm','1')"><span>保存</span></a></li>
            </shiro:hasPermission>
            <li>
            <a class="ret" href="#" onclick="hrefRet_OnClick('${ctx}/sysRemindConfig/list')"><span>返回</span></a>
            </li>
        </ul>
    </div>
    <div class="pageFormContent" layoutH="56">
		<dl>
			<dt>配置名称：</dt>
			<dd>
				<input type="text" name="configName" value="${sysRemindConfig.configName}" maxlength="20" class=""/>
			</dd>
		</dl>
		<dl>
			<dt>提醒方式：</dt>
			<dd>
				<input type="hidden" name="remindId" value="${sysRemindConfig.remindId}" bringBackName="RemindType.id"/>
				<input class="required" name="remindName" type="text" 
				value="${sysRemindConfig.remindName}" readonly="readonly"
				postField="keywords"
				bringBackName="RemindType.name"
				suggestFields="name" 
				suggestUrl="${ctx}/pubTable/suggest?tableName=Pub_Sys_RemindType&type=notTop"
				lookupGroup="RemindType"
				/>
			</dd>
		</dl>
		<dl>
			<dt>消息类型：</dt>
			<dd>
				<input type="hidden" name="typeId" value="${sysRemindConfig.typeId}" bringBackName="MessageType.id"/>
				<input class="required" name="typeName" type="text" 
				value="${sysRemindConfig.typeName}" readonly="readonly"
				postField="keywords"
				bringBackName="MessageType.name"
				suggestFields="name" 
				suggestUrl="${ctx}/pubTable/suggest?tableName=Pub_Sys_MessageType&type=notTop"
				lookupGroup="MessageType"
				/>
			</dd>
		</dl>
		<dl class="nowrap">
			<dt>SqlMapID：</dt>
			<dd>
				<input type="text" name="sqlMapID" value="${sysRemindConfig.sqlMapID}" style="width: 515px;" class=""/>
			</dd>
		</dl>
		<dl class="nowrap">
			<dt>查看地址：</dt>
			<dd>
				<input type="text" name="showUrl" value="${sysRemindConfig.showUrl}" style="width: 515px;" class=""/>
			</dd>
		</dl>
		<dl>
			<dt>更新频率：</dt>
			<dd>
				<input type="text" name="frequency" value="${sysRemindConfig.frequency}" maxlength="20" class="number"/>&nbsp;天
			</dd>
		</dl>
		<dl>
			<dt>是否提醒每个用户：</dt>
			<dd>
				<input type="radio" name="isRemindAllUsers" ${sysRemindConfig.isRemindAllUsers == 0 ? 'checked="checked"':''} value="0" />不是
				<input type="radio" name="isRemindAllUsers" ${sysRemindConfig.isRemindAllUsers == 1 ? 'checked="checked"':''} value="1" />是
			</dd>
		</dl>
		
		<div id="isRemindAllUsersResult">
			<dl class="nowrap">
				<dt>提醒用户：</dt>
				<dd>
					<input name="remindUsers" bringBackName="sysUser.id" value="${sysRemindConfig.remindUsers}"  type="text" readonly="readonly" style="width: 515px;">
					<input name="remindUsersName" bringBackName="sysUser.orgName" value="${sysRemindConfig.remindUsersName}"  type="hidden" readonly="readonly" style="width: 515px;"/>
					<a class="btnLook" href="${ctx}/sysSelect/lookCheck?code=user" lookupGroup="sysUser">查找带回</a>
				</dd>
			</dl>
			<dl class="nowrap">
				<dt>提醒部门：</dt>
				<dd>
					<input name="remindBumen" bringBackName="department.selectId" value="${sysRemindConfig.remindBumen}"  type="text" readonly="readonly" style="width: 515px;">
					<input name="remindBumenName" bringBackName="department.selectName" value="${sysRemindConfig.remindBumenName}"  type="hidden" readonly="readonly" style="width: 515px;"/>
					<a class="btnLook" href="${ctx}/sysDepartment/lookRadio" lookupGroup="department">选择部门</a>
				</dd>
			</dl>
			<dl class="nowrap">
				<dt>提醒岗位：</dt>
				<dd>
				    <input name="remindPost" bringBackName="post.postId" value="${sysRemindConfig.remindPost}"  type="text" readonly="readonly" style="width: 515px;">
					<input name="remindPostName" bringBackName="post.postName" value="${sysRemindConfig.remindPostName}"  type="hidden" readonly="readonly" style="width: 515px;"/>
					<a class="btnLook" href="${ctx}/sysPost/lookCheck" lookupGroup="post">查找带回</a>
				</dd>
			</dl>
			<dl class="nowrap">
				<dt>提醒角色：</dt>
				<dd>
					<input name="remindRole" bringBackName="sysRole.id" value="${sysRemindConfig.remindRole}"  type="text" readonly="readonly" style="width: 515px;">
					<input name="remindRoleName" bringBackName="sysRole.orgName" value="${sysRemindConfig.remindRoleName}"  type="hidden" readonly="readonly" style="width: 515px;"/>
					<a class="btnLook" href="${ctx}/sysRole/lookCheck" lookupGroup="sysRole">查找带回</a>
				</dd>
			</dl>
		</div>
		<dl>
			<dt>标题：</dt>
			<dd>
				<input type="text" name="titleStr" value="${sysRemindConfig.titleStr}" maxlength="50" class=""/>
			</dd>
		</dl>
		<dl class="nowrap">
			<dt>消息内容：</dt>
			<dd>
				<textarea name="messageContent" cols="60" rows="2" style="width: 515px;">${sysRemindConfig.messageContent}</textarea>
			</dd>
		</dl>
		<dl>
			<dt>返回结果替换格式：</dt>
			<dd>
				<input type="text" name="resultGsh" value="${sysRemindConfig.resultGsh}" maxlength="20" class=""/>
			</dd>
		</dl>
		<dl>
			<dt>返回结果类型：</dt>
			<dd>
				<select name="resultType">
					<option value="1" ${sysRemindConfig.resultType == 1 ? 'selected="selected"':''} onclick="change(0)">字符</option>
					<option value="2" ${sysRemindConfig.resultType == 2 ? 'selected="selected"':''} onclick="change(0)">结果集</option>
					<option value="0" ${sysRemindConfig.resultType == 0 ? 'selected="selected"':''} onclick="change(1)">带用户的结果集</option>
				</select>
			</dd>
		</dl>
		<dl class="nowrap">
			<dt>备注：</dt>
			<dd>
			<textarea name="Remarks" cols="60" rows="2" style="width: 515px;">${sysRemindConfig.remarks}</textarea>
			</dd>
		</dl>
    </div>
</form>
<script type="text/javascript">

function change(state){
	if(state == 0) {
		$("#isRemindAllUsersResult").css("display","block");
	}else {
		$("#isRemindAllUsersResult").css("display","none");
	}
}

isRemindAllUsersResult();
$("input[name='isRemindAllUsers']").change(function() {
	isRemindAllUsersResult();
});
function isRemindAllUsersResult(){
	var val = $("input[name='isRemindAllUsers']:checked").val();
	if(val == 0) {
		$("#isRemindAllUsersResult").css("display","block");
	}else {
		$("#isRemindAllUsersResult").css("display","none");
	}
}
function sysRemindConfigForm_custom_Validate(){
	var val = $("input[name='isRemindAllUsers']:checked").val();
	if(val == 1) {
		$("#isRemindAllUsersResult").empty();
	}
	return true;
}
</script>
</div>